package com.ssy.lingxi.pay.handler.notify;

import com.ssy.lingxi.component.rabbitMQ.constants.MessageConstants;
import com.ssy.lingxi.pay.service.assetAccount.IMemberAssetAccountService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.amqp.rabbit.annotation.RabbitHandler;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

/**
 * 会员资金账户充值-消息队列监听类
 * @author jw.chen
 * @version 2.0.0
 * @date 2020/10/22
 */
@Component
@RabbitListener(queues = MessageConstants.pay_recharge_delay_queue)
public class RechargeMessageHandler {

    @Autowired
    private IMemberAssetAccountService memberAssetAccountService;

    private final Logger log = LoggerFactory.getLogger(this.getClass());

    @RabbitHandler
    public void handler(Long accountTradeRecordId){
        log.info("收到通知，会员资金账户充值记录支付失败，记录id: "+accountTradeRecordId);
        memberAssetAccountService.updateAccountTradeRecordPayingFail(accountTradeRecordId);
    }
}
